#ifndef LOGMANAGER_H
#define LOGMANAGER_H

#include "Log.h"
#include <vector>
#include <mutex>

class LogManager {
public:
    static LogManager& getInstance();

    void logAction(Log::LogType logType, int userId, int deviceId, const std::string& content);
    void saveLogsToFile(const std::string& filename);
    std::vector<Log> getLogsByUser(int userId) const;
    std::vector<Log> getLogsByDevice(int deviceId) const;

private:
    LogManager();
    ~LogManager();

    std::vector<Log> logs;
    std::mutex logMutex; // 用于线程安全的日志写入
};

#endif // LOGMANAGER_H